<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <style>
	.KEYW {color: #933;}
	.COMM {color: #bbb; font-style: italic;}
	.NUMB {color: #393;}
	.STRN {color: #393;}
	.REGX {color: #339;}
	.line {border-right: 1px dotted #666; color: #666; font-style: normal;}
	</style></head><body><pre><span class='line'>  1</span> <span class="NAME">KISSY.add</span><span class="PUNC">(</span><span class="STRN">'gallery/form/1.0/uploader/themes/grayQueue/status'</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">S</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">Node</span><span class="PUNC">,</span><span class="NAME">ProgressBar</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">StatusBase</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>  2</span> </span><span class="WHIT">    </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="STRN">''</span><span class="PUNC">,</span><span class="NAME">$</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Node.all</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>  3</span> </span><span class="WHIT">    </span><span class="WHIT">
<span class='line'>  4</span> </span><span class="WHIT">    </span><span class="COMM">/**
<span class='line'>  5</span>      * @name GrayQueueStatus
<span class='line'>  6</span>      * @class 状态类
<span class='line'>  7</span>      * @constructor
<span class='line'>  8</span>      * @extends Base
<span class='line'>  9</span>      * @requires Node
<span class='line'> 10</span>      */</span><span class="WHIT">
<span class='line'> 11</span> </span><span class="WHIT">    </span><span class="KEYW">function</span><span class="WHIT"> </span><span class="NAME">Status</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 12</span> </span><span class="WHIT">        </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 13</span> </span><span class="WHIT">        </span><span class="COMM">//调用父类构造函数</span><span class="WHIT">
<span class='line'> 14</span> </span><span class="WHIT">        </span><span class="NAME">Status.superclass.constructor.call</span><span class="PUNC">(</span><span class="NAME">self</span><span class="PUNC">,</span><span class="NAME">target</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">config</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 15</span> </span><span class="WHIT">        </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'target'</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">$</span><span class="PUNC">(</span><span class="NAME">target</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 16</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 17</span> </span><span class="WHIT">    </span><span class="NAME">Status.type</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">StatusBase.type</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 18</span> </span><span class="WHIT">    </span><span class="NAME">S.extend</span><span class="PUNC">(</span><span class="NAME">Status</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">StatusBase</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="COMM">/** @lends Status.prototype*/</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 19</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 20</span>          * 等待上传时状态层内容
<span class='line'> 21</span>          */</span><span class="WHIT">
<span class='line'> 22</span> </span><span class="WHIT">        </span><span class="NAME">_waiting</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 23</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'tpl'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">waitingTpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tpl.waiting</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 24</span> </span><span class="WHIT">                </span><span class="NAME">uploader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploader'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 25</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 26</span> </span><span class="WHIT">                </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'file'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 27</span> </span><span class="WHIT">                </span><span class="NAME">id</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">file.id</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 28</span> </span><span class="WHIT">                </span><span class="COMM">//所有文件大小</span><span class="WHIT">
<span class='line'> 29</span> </span><span class="WHIT">                </span><span class="NAME">total</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'total'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 30</span> </span><span class="WHIT">                </span><span class="COMM">//等待上传的文件大小</span><span class="WHIT">
<span class='line'> 31</span> </span><span class="WHIT">                </span><span class="NAME">size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">file.size</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 32</span> </span><span class="WHIT">                </span><span class="COMM">//刷新状态层内容</span><span class="WHIT">
<span class='line'> 33</span> </span><span class="WHIT">                </span><span class="NAME">$content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._changeDom</span><span class="PUNC">(</span><span class="NAME">waitingTpl</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 34</span> </span><span class="WHIT">                </span><span class="COMM">//删除图标元素</span><span class="WHIT">
<span class='line'> 35</span> </span><span class="WHIT">                </span><span class="NAME">$del</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$content.children</span><span class="PUNC">(</span><span class="STRN">'.J_DelFile'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 36</span> </span><span class="WHIT">            </span><span class="COMM">//点击删除图标</span><span class="WHIT">
<span class='line'> 37</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="NAME">$del.length</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 38</span> </span><span class="WHIT">                </span><span class="NAME">$del.on</span><span class="PUNC">(</span><span class="STRN">'click'</span><span class="PUNC">,</span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">ev</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 39</span> </span><span class="WHIT">                    </span><span class="COMM">//删除队列中的文件</span><span class="WHIT">
<span class='line'> 40</span> </span><span class="WHIT">                    </span><span class="NAME">queue.remove</span><span class="PUNC">(</span><span class="NAME">id</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 41</span> </span><span class="WHIT">                    </span><span class="COMM">//文件总字节数需要减去该文件大小</span><span class="WHIT">
<span class='line'> 42</span> </span><span class="WHIT">                    </span><span class="NAME">total</span><span class="WHIT">  </span><span class="PUNC">-</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">size</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 43</span> </span><span class="WHIT">                    </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'#J_TotalSize'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">text</span><span class="PUNC">(</span><span class="NAME">StatusBase.convertByteSize</span><span class="PUNC">(</span><span class="NAME">total</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 44</span> </span><span class="WHIT">                    </span><span class="NAME">uploader.set</span><span class="PUNC">(</span><span class="STRN">'total'</span><span class="PUNC">,</span><span class="NAME">total</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 45</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="PUNC">)</span><span class="WHIT">
<span class='line'> 46</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 47</span> </span><span class="WHIT">            </span><span class="COMM">//不存在文件大小，直接退出</span><span class="WHIT">
<span class='line'> 48</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">size</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 49</span> </span><span class="WHIT">            </span><span class="COMM">//如果不存在已经加载字节数，那么设置为0</span><span class="WHIT">
<span class='line'> 50</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">total</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 51</span> </span><span class="WHIT">                </span><span class="NAME">total</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">size</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 52</span> </span><span class="WHIT">                </span><span class="NAME">uploader.set</span><span class="PUNC">(</span><span class="STRN">'loaded'</span><span class="PUNC">,</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 53</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="KEYW">else</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 54</span> </span><span class="WHIT">                </span><span class="COMM">//总字节数加上当前文件字节数</span><span class="WHIT">
<span class='line'> 55</span> </span><span class="WHIT">                </span><span class="NAME">total</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">size</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 56</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 57</span> </span><span class="WHIT">            </span><span class="COMM">//改变总字节数，StatusBase.convertByteSize方法，会将345345改成kb或mb单位显示</span><span class="WHIT">
<span class='line'> 58</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'#J_TotalSize'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">text</span><span class="PUNC">(</span><span class="NAME">StatusBase.convertByteSize</span><span class="PUNC">(</span><span class="NAME">total</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 59</span> </span><span class="WHIT">            </span><span class="NAME">uploader.set</span><span class="PUNC">(</span><span class="STRN">'total'</span><span class="PUNC">,</span><span class="NAME">total</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 60</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 61</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 62</span>          * 开始上传后改成状态层内容
<span class='line'> 63</span>          */</span><span class="WHIT">
<span class='line'> 64</span> </span><span class="WHIT">        </span><span class="NAME">_start</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 65</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'tpl'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">startTpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tpl.start</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 66</span> </span><span class="WHIT">                </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'target'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 67</span> </span><span class="WHIT">                </span><span class="NAME">uploader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploader'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 68</span> </span><span class="WHIT">                </span><span class="NAME">uploadType</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'type'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 69</span> </span><span class="WHIT">                </span><span class="NAME">$content</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 70</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isString</span><span class="PUNC">(</span><span class="NAME">startTpl</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 71</span> </span><span class="WHIT">            </span><span class="COMM">//改变状态层内容</span><span class="WHIT">
<span class='line'> 72</span> </span><span class="WHIT">            </span><span class="NAME">$content</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self._changeDom</span><span class="PUNC">(</span><span class="NAME">startTpl</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 73</span> </span><span class="WHIT">            </span><span class="COMM">//如果是ajax异步上传，加入进度显示</span><span class="WHIT">
<span class='line'> 74</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="NAME">uploadType</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="STRN">'ajax'</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 75</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">progressBar</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 76</span> </span><span class="WHIT">                </span><span class="COMM">//如果不存在进度条，先初始化进度条组件</span><span class="WHIT">
<span class='line'> 77</span> </span><span class="WHIT">                </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'progressBar'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 78</span> </span><span class="WHIT">                    </span><span class="NAME">progressBar</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">new</span><span class="WHIT"> </span><span class="NAME">ProgressBar</span><span class="PUNC">(</span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'#J_ProgressBar'</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 79</span> </span><span class="WHIT">                    </span><span class="NAME">progressBar.render</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 80</span> </span><span class="WHIT">                    </span><span class="NAME">uploader.set</span><span class="PUNC">(</span><span class="STRN">'progressBar'</span><span class="PUNC">,</span><span class="NAME">progressBar</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 81</span> </span><span class="WHIT">                </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 82</span> </span><span class="WHIT">                </span><span class="COMM">//清零进度条</span><span class="WHIT">
<span class='line'> 83</span> </span><span class="WHIT">                </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'progressBar'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">set</span><span class="PUNC">(</span><span class="STRN">'value'</span><span class="PUNC">,</span><span class="NUMB">0</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 84</span> </span><span class="WHIT">                </span><span class="COMM">//将进度百分比设置为0%</span><span class="WHIT">
<span class='line'> 85</span> </span><span class="WHIT">                </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$progressNum</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">$content.children</span><span class="PUNC">(</span><span class="STRN">'.J_ProgressNum'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 86</span> </span><span class="WHIT">                </span><span class="NAME">$progressNum.html</span><span class="PUNC">(</span><span class="STRN">"0%"</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 87</span> </span><span class="WHIT">                </span><span class="NAME">self.set</span><span class="PUNC">(</span><span class="STRN">'elProgressNum'</span><span class="PUNC">,</span><span class="NAME">$progressNum</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 88</span> </span><span class="WHIT">            </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'> 89</span> </span><span class="WHIT">            </span><span class="COMM">//给li增加current-upload-file样式</span><span class="WHIT">
<span class='line'> 90</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$parent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 91</span> </span><span class="WHIT">            </span><span class="NAME">$parent.addClass</span><span class="PUNC">(</span><span class="STRN">'current-upload-file'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'> 92</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 93</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'> 94</span>          * 正在上传时候刷新状态层的内容
<span class='line'> 95</span>          * @param data
<span class='line'> 96</span>          */</span><span class="WHIT">
<span class='line'> 97</span> </span><span class="WHIT">        </span><span class="NAME">_progress</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="NAME">data</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'> 98</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'> 99</span> </span><span class="WHIT">                </span><span class="COMM">//已经加载的字节数</span><span class="WHIT">
<span class='line'>100</span> </span><span class="WHIT">                </span><span class="NAME">loaded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.loaded</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>101</span> </span><span class="WHIT">                </span><span class="COMM">//当前文件字节总数</span><span class="WHIT">
<span class='line'>102</span> </span><span class="WHIT">                </span><span class="NAME">total</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">data.total</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>103</span> </span><span class="WHIT">                </span><span class="COMM">//百分比</span><span class="WHIT">
<span class='line'>104</span> </span><span class="WHIT">                </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Math.ceil</span><span class="PUNC">(</span><span class="NAME">loaded</span><span class="PUNC">/</span><span class="NAME">total</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>105</span> </span><span class="WHIT">                </span><span class="NAME">uploader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploader'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>106</span> </span><span class="WHIT">                </span><span class="COMM">//进度条</span><span class="WHIT">
<span class='line'>107</span> </span><span class="WHIT">                </span><span class="NAME">proccessBar</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'progressBar'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>108</span> </span><span class="WHIT">                </span><span class="COMM">//所有文件的字节总数</span><span class="WHIT">
<span class='line'>109</span> </span><span class="WHIT">                </span><span class="NAME">allFileTotal</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'total'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>110</span> </span><span class="WHIT">                </span><span class="COMM">//所有文件已经加载的字节数</span><span class="WHIT">
<span class='line'>111</span> </span><span class="WHIT">                </span><span class="NAME">allFileLoaded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'loaded'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>112</span> </span><span class="WHIT">                </span><span class="NAME">$elProgressNum</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'elProgressNum'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>113</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">$elProgressNum.length</span><span class="WHIT"> </span><span class="PUNC">||</span><span class="WHIT"> </span><span class="NAME">proccessBar</span><span class="WHIT"> </span><span class="PUNC">==</span><span class="WHIT"> </span><span class="NAME">EMPTY</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>114</span> </span><span class="WHIT">            </span><span class="NAME">$elProgressNum.html</span><span class="PUNC">(</span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'%'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>115</span> </span><span class="WHIT">            </span><span class="COMM">//改变总进度显示</span><span class="WHIT">
<span class='line'>116</span> </span><span class="WHIT">            </span><span class="NAME">loaded</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">allFileLoaded</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>117</span> </span><span class="WHIT">            </span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">Math.ceil</span><span class="PUNC">(</span><span class="NAME">loaded</span><span class="PUNC">/</span><span class="NAME">allFileTotal</span><span class="WHIT"> </span><span class="PUNC">*</span><span class="WHIT"> </span><span class="NUMB">100</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>118</span> </span><span class="WHIT">            </span><span class="NAME">proccessBar.set</span><span class="PUNC">(</span><span class="STRN">'value'</span><span class="PUNC">,</span><span class="NAME">val</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>119</span> </span><span class="WHIT">            </span><span class="NAME">$</span><span class="PUNC">(</span><span class="STRN">'#J_TotalProgressNum'</span><span class="PUNC">)</span><span class="PUNC">.</span><span class="NAME">text</span><span class="PUNC">(</span><span class="NAME">val</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT"> </span><span class="STRN">'%'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>120</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>121</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>122</span>          * 文件上传成功后
<span class='line'>123</span>          */</span><span class="WHIT">
<span class='line'>124</span> </span><span class="WHIT">        </span><span class="NAME">_success</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="KEYW">function</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>125</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">self</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="KEYW">this</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="NAME">tpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'tpl'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="NAME">successTpl</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">tpl.success</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>126</span> </span><span class="WHIT">                </span><span class="COMM">//状态层容器</span><span class="WHIT">
<span class='line'>127</span> </span><span class="WHIT">                </span><span class="NAME">target</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'target'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>128</span> </span><span class="WHIT">                </span><span class="NAME">queue</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'queue'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>129</span> </span><span class="WHIT">                </span><span class="NAME">file</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'file'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>130</span> </span><span class="WHIT">                </span><span class="NAME">size</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">file.size</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>131</span> </span><span class="WHIT">                </span><span class="NAME">uploader</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">self.get</span><span class="PUNC">(</span><span class="STRN">'uploader'</span><span class="PUNC">)</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>132</span> </span><span class="WHIT">                </span><span class="NAME">loaded</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">uploader.get</span><span class="PUNC">(</span><span class="STRN">'loaded'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>133</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="WHIT"> </span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">S.isString</span><span class="PUNC">(</span><span class="NAME">successTpl</span><span class="PUNC">)</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>134</span> </span><span class="WHIT">            </span><span class="NAME">self._changeDom</span><span class="PUNC">(</span><span class="NAME">successTpl</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>135</span> </span><span class="WHIT">            </span><span class="COMM">//删除li的current-upload-file样式</span><span class="WHIT">
<span class='line'>136</span> </span><span class="WHIT">            </span><span class="KEYW">var</span><span class="WHIT"> </span><span class="NAME">$parent</span><span class="WHIT"> </span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">target.parent</span><span class="PUNC">(</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>137</span> </span><span class="WHIT">            </span><span class="NAME">$parent.removeClass</span><span class="PUNC">(</span><span class="STRN">'current-upload-file'</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>138</span> </span><span class="WHIT">            </span><span class="KEYW">if</span><span class="PUNC">(</span><span class="PUNC">!</span><span class="NAME">size</span><span class="PUNC">)</span><span class="WHIT"> </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="KEYW">false</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>139</span> </span><span class="WHIT">            </span><span class="COMM">//设置所有文件已经加载的字节数</span><span class="WHIT">
<span class='line'>140</span> </span><span class="WHIT">            </span><span class="NAME">loaded</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="PUNC">=</span><span class="WHIT"> </span><span class="NAME">size</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>141</span> </span><span class="WHIT">            </span><span class="NAME">uploader.set</span><span class="PUNC">(</span><span class="STRN">'loaded'</span><span class="PUNC">,</span><span class="NAME">loaded</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>142</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>143</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">ATTRS</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="COMM">/** @lends Status*/</span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>144</span> </span><span class="WHIT">        </span><span class="COMM">/**
<span class='line'>145</span>          * 模板
<span class='line'>146</span>          */</span><span class="WHIT">
<span class='line'>147</span> </span><span class="WHIT">        </span><span class="NAME">tpl</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">value</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="WHIT">
<span class='line'>148</span> </span><span class="WHIT">            </span><span class="NAME">waiting</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&lt;div class="clearfix">&lt;div class="f-l">0%&lt;/div>&lt;div class="f-l uploader-icon del-icon J_DelFile">&lt;/div>&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>149</span> </span><span class="WHIT">            </span><span class="NAME">start</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&lt;div class="clearfix">&lt;div class="J_ProgressNum">&lt;img class="loading" src="http://img01.taobaocdn.com/tps/i1/T1F5tVXjRfXXXXXXXX-16-16.gif" alt="loading" />&lt;/div>'</span><span class="WHIT"> </span><span class="PUNC">+</span><span class="WHIT">
<span class='line'>150</span> </span><span class="WHIT">                </span><span class="STRN">'&lt;/div> '</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>151</span> </span><span class="WHIT">            </span><span class="NAME">success</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&lt;div class="uploader-icon success-icon">100%&lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>152</span> </span><span class="WHIT">            </span><span class="NAME">cancel</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&lt;div>已经取消上传，&lt;a href="#reUpload" class="J_ReUpload">点此重新上传&lt;/a> &lt;/div>'</span><span class="PUNC">,</span><span class="WHIT">
<span class='line'>153</span> </span><span class="WHIT">            </span><span class="NAME">error</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="STRN">'&lt;div class="upload-error">{msg}&lt;a href="#fileDel" class="J_FileDel">点此删除&lt;/a>&lt;/div>'</span><span class="WHIT">
<span class='line'>154</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>155</span> </span><span class="WHIT">        </span><span class="PUNC">}</span><span class="WHIT">
<span class='line'>156</span> </span><span class="WHIT">    </span><span class="PUNC">}</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>157</span> </span><span class="WHIT">    </span><span class="KEYW">return</span><span class="WHIT"> </span><span class="NAME">Status</span><span class="PUNC">;</span><span class="WHIT">
<span class='line'>158</span> </span><span class="PUNC">}</span><span class="PUNC">,</span><span class="WHIT"> </span><span class="PUNC">{</span><span class="NAME">requires</span><span class="WHIT"> </span><span class="PUNC">:</span><span class="WHIT"> </span><span class="PUNC">[</span><span class="STRN">'node'</span><span class="PUNC">,</span><span class="STRN">'../../plugins/progressBar/progressBar'</span><span class="PUNC">,</span><span class="STRN">'../../queue/status'</span><span class="PUNC">]</span><span class="PUNC">}</span><span class="PUNC">)</span><span class="PUNC">;</span></pre></body></html>